package com.cz.ssyx.common.exception;

import com.cz.ssyx.common.result.ResultCodeEnum;
import lombok.Data;

/**
 * @descriptions: 自定义异常
 * @author: Joker.
 * @date: 2024/4/13 21:08
 * @version: 1.0
 */

@Data
public class MyException extends RuntimeException{

    private Integer code;

    public MyException(String message, Integer code) {
        super(message);
        this.code = code;
    }

    //接收枚举类型的对象
    public MyException(ResultCodeEnum resultCodeEnum) {
        super(resultCodeEnum.getMessage());
        this.code = resultCodeEnum.getCode();
    }
}
